import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity('tb_points_rule', {
  comment: '积分规则表',
})
export class PointsRule {
  @PrimaryGeneratedColumn('increment', { comment: '自增主键', unsigned: true })
  id: number;

  @Column({ comment: '规则名称' })
  name: string;

  @Column({ comment: '规则标识', unique: true })
  mark: string;
}

@Entity('tb_points_product', {
  comment: '积分商品表',
})
export class PointsProduct {
  @PrimaryGeneratedColumn('increment', { comment: '自增主键', unsigned: true })
  id: number;

  @Column({ comment: '商品ID' })
  productId: number;

  @Column({ comment: '兑换规格' })
  specs: string;
}

@Entity('tb_points_record', {
  comment: '积分记录表',
})
export class PointsRecord {
  @PrimaryGeneratedColumn('increment', { comment: '自增主键', unsigned: true })
  id: number;

  @Column({ comment: '用户ID' })
  userId: number;

  @Column({ comment: '积分数值', unsigned: true })
  score: number;

  @Column({ comment: '积分标题' })
  title: string;

  @Column({ comment: '积分描述' })
  description: string;
}
